import 'package:my_flutter_core/my_flutter_core.dart';

class IncomeExpenseDetailSummary {
  IncomeExpenseDetailSummary({
    this.incomeExpenseDate,
    this.cashIncome,
    this.cashExpense,
    this.cashBalance,
    this.creditCardIncome,
    this.creditCardExpense,
    this.creditCardBalance,
  });

  factory IncomeExpenseDetailSummary.fromJson(Map<String, dynamic> json) {
    return IncomeExpenseDetailSummary(
      incomeExpenseDate: tryToConvert<DateTime>(
        json['incomeExpenseDate'],
        (p) => parseDate(p),
      ),
      cashIncome: json['cashIncome']?.toDouble(),
      cashExpense: json['cashExpense']?.toDouble(),
      cashBalance: json['cashBalance']?.toDouble(),
      creditCardIncome: json['creditCardIncome']?.toDouble(),
      creditCardExpense: json['creditCardExpense']?.toDouble(),
      creditCardBalance: json['creditCardBalance']?.toDouble(),
    );
  }

  DateTime? incomeExpenseDate;
  double? cashIncome;
  double? cashExpense;
  double? cashBalance;
  double? creditCardIncome;
  double? creditCardExpense;
  double? creditCardBalance;
}
